<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
    <body>
        <h3>Invoice Detail</h3>
        <p>Date : <fmt:formatDate value="${invoice.tgl}" pattern="dd MMM yyyy"/></p>
        <p>Customer : ${invoice.customer.nama}, ${invoice.customer.alamat}</p>
        <p>Product List</p>
        <table border="1">
            <tr>
                <td>Name</td>
                <td>Price</td>
                <td>Quantity</td>
                <td>Subtotal</td>
            </tr>
            <c:forEach items="${invoice.details}" var="detail">
                <tr>
                    <td>${detail.product.name}</td>
                    <td>${detail.price}</td>
                    <td>${detail.quantity}</td>
                    <td>${detail.price * detail.quantity}</td>
                </tr>
            </c:forEach>
        </table>
        <p><a href="controller?action=invoice_add_product">Add Product</a> | 
            <a href="controller?action=invoice_save">Save Invoice</a></p>
    </body>
</html>